//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>

#include "ProcessCathPDBProfile.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int main (int argc, char** argv) {
  
  String* namefileFASTAProfile    = NULL;
  String* locationPDB             = NULL;
  String* locationPDBHetAtmDomain = NULL;

  if (argc < 4) {
    
    cout << "Error in the input parameters! Must by like: " << endl;
    cout << "./CreatePDBHetAtmDomain <Profile FASTA Files> <PDB Database Location> <Location to put the PDB (HetAtm) domain Files>" << endl;
    
    return 0;
    
  }
  else {
    
    namefileFASTAProfile    = new String(argv[1]);
    locationPDB             = new String(argv[2]);
    locationPDBHetAtmDomain = new String(argv[3]);
    
    cout << "---------------------------------------------------------------------------------" << endl;
    cout << "                           Profile FASTA Files : " << argv[1] << endl;
    cout << "                         PDB Database Location : " << argv[2] << endl;
    cout << " Location to put the PDB (HetAtm) domain Files : " << argv[3] << endl;
    cout << "---------------------------------------------------------------------------------" << endl;
    
  }
  
  ProcessCathPDBProfile* processCathPDBProfile = new ProcessCathPDBProfile ();
  
  cout << "Preparing Files..." << endl;
  processCathPDBProfile->NamefileFASTAProfile(namefileFASTAProfile);
  processCathPDBProfile->LocationPDB(locationPDB);
  processCathPDBProfile->LocationPDBHetAtmDomain(locationPDBHetAtmDomain);
  
  cout << "Loading Profile FASTA File with Domain Descriptions..." << endl;
  processCathPDBProfile->LoadDataFastaProfile();
  
  cout << "Number of Domains (repeat Seq) : " << processCathPDBProfile->ListDomainProfile()->Length() << endl;
  
  cout << "Writing the PDB (Atom records) domain Files..." << endl;
  processCathPDBProfile->CreatePDBDomainHetAtm();
  
  cout << "Finished..." << endl << "Good Bye" << endl;
  
  if (processCathPDBProfile)   delete processCathPDBProfile;
  
  if (namefileFASTAProfile)    delete namefileFASTAProfile;
  if (locationPDB)             delete locationPDB;
  if (locationPDBHetAtmDomain) delete locationPDBHetAtmDomain;

  return EXIT_SUCCESS;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//

